put ScrollBar(false, false, true, 0, 7, Pitch, 1) into Pitch
put Pitch into cd fld "Pitch"
end doControl
on initButton
global Pitch
put 4 into Pitch
put Pitch into cd fld "Pitch"
end initButton
on trackScroll
global ScrollValue
put ScrollValue into cd fld "Pitch"
end trackScroll
-- part 3 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=378 top=174 right=202 bottom=394
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
----- HyperTalk script -----
on mouseUp
send doControl to cd btn "Pitch"
end mouseUp
-- part 4 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=474 top=119 right=266 bottom=490
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Tempo
----- HyperTalk script -----
on doControl
global Tempo
put ScrollBar(false, false, true, 1, 20, trunc(Tempo/30), 1) * 30 into Tempo
put Tempo into cd fld "Tempo"
end doControl
on initButton
global Tempo
put 210 into Tempo
put Tempo into cd fld "Tempo"
end initButton
on trackScroll
global ScrollValue
put ScrollValue * 30 into cd fld "Tempo"
end trackScroll
-- part 5 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=474 top=174 right=202 bottom=490
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
----- HyperTalk script -----
on mouseUp
send doControl to cd btn "Tempo"
end mouseUp
-- part 6 (button)
-- low flags: 00
-- high flags: 8001
-- rect: left=371 top=219 right=266 bottom=431
-- title width / last selected line: 0
-- icon id / first selected line: 12694 / 12694
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Sample Tune
----- HyperTalk script -----
on mouseUp
global Tempo, Pitch
playTune
set the name of me to "Stop Sample"
set the icon of me to "Sp 0"
repeat forever
if the sound is "done" or the mouse is "down" then exit repeat
end repeat
play stop
set the name of me to "Sample Tune"
set the icon of me to "Music Note"
end mouseUp
-- part 7 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=350 top=178 right=199 bottom=377
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Pitch
-- part 8 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=443 top=178 right=200 bottom=473
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Tempo
-- part 9 (field)
-- low flags: 81
-- high flags: 0007
-- rect: left=15 top=15 right=273 bottom=497
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: Script
-- part contents for background part 3
----- text -----
The two buttons both popup a scroll bar when clicked which can then be used to alter the value of the pitch and tempo of the sample tune. The buttons do not call ScrollBar() directly but send a doControl message to a larger button which is the desired size of the scroll bar. To enable scroll bar popup doPaint is set false; and to track the values doControl is set true.
-- part contents for card part 7
----- text -----
4
-- part contents for card part 8
----- text -----
210
-- part contents for card part 9
----- text -----
Script of adjust pitch button:
on mouseUp
send doControl to cd btn "Pitch"
end mouseUp
Script of button Pitch:
on doControl
global Pitch
put ScrollBar(false, false, true, 0, 7, Pitch, 1) into Pitch